package com.mku.wms_service.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mku.wms_service.common.QueryPageParam;
import com.mku.wms_service.common.Response;
import com.mku.wms_service.entity.Storage;
import com.mku.wms_service.service.IStorageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author maoxx
 * @since 2024-11-22
 */
@RestController
@RequestMapping("/storage")
public class StorageController {

    @Autowired
    private IStorageService storageService;

    @ApiOperation("获取库存列表")
    @PostMapping("/listPage")
    public Response<Page<Storage>> listPage(@RequestBody QueryPageParam qp2){
        return storageService.getListByPage(qp2);
    }

    @ApiOperation("添加/编辑库存信息")
    @PostMapping
    public Response<Storage> add(@RequestBody Storage storage) {
        return storageService.add(storage);
    }

    @ApiOperation("删除库存信息")
    @DeleteMapping("/{id}")
    public Response<Storage> delete(@PathVariable Integer id) {
        return storageService.delete(id);
    }

    @ApiOperation("获取库存信息列表")
    @GetMapping("/listAll")
    public Response<List<Storage>> listAll() {
        return storageService.listAll();
    }





}
